set panelCastNumLst to [#topPanelSpr: the number of cast "top panel base", #bottomPanelSpr: the number of cast "bottom panel base", #rightPanelSpr: the number of cast "right panel base", #leftPanelSpr: the number of cast "left panel base"]
set topPanelCastNumLst to [the number of cast "new hilite", the number of cast "open hilite", the number of cast "save hilite", the number of cast "save as hilite", the number of cast "quit hilite"]
set rightPanelCastNumLst to [the number of cast "homer hilite", the number of cast "marge hilite", the number of cast "bart hilite", the number of cast "lisa hilite", the number of cast "maggie hilite", the number of cast "cameo hilite", the number of cast "props hilite", the number of cast "soundFX hilite", the number of cast "specialFX hilite", the number of cast "backgrounds hilite"]
set bottomPanelCastNumLst to [the number of cast "rewind hilite", the number of cast "fastforward hilite", the number of cast "stepback hilite", the number of cast "stepforward hilite", the number of cast "cut hilite"]
set leftPanelCastNumLst to [the number of cast "memory hilite", the number of cast "volume hilite", the number of cast "export hilite"]
set btnSelCastNumLst to [the number of cast "homer selected", the number of cast "marge selected", the number of cast "bart selected", the number of cast "lisa selected", the number of cast "maggie selected", the number of cast "cameo selected", the number of cast "props selected", the number of cast "soundFX selected", the number of cast "specialFX selected", the number of cast "backgrounds selected"]
return me
end
on panelClick me, theMouseH, theMouseV, whichSpr
set panelSeqLst to ["top", "bottom", "left", "right"]
set panelPrefix to getAt(panelSeqLst, whichSpr - topPanelSpr + 1)
set panelCastNum to getaProp(panelCastNumLst, value("#" & panelPrefix & "PanelSpr"))
set btnCastNumLst to value(panelPrefix & "PanelCastNumLst")
set btnBoundsLst to value(line 1 of field (panelPrefix & "PanelData"))
set btnPosLst to value(line 2 of field (panelPrefix & "PanelData"))
set btnActionLst to value(line 3 of field (panelPrefix & "PanelData"))
set btnSoundLst to value(line 4 of field (panelPrefix & "PanelData"))